package cn.sdormitory.wx.service.impl;

import cn.sdormitory.wx.mapper.WechatPushMessageMapper;
import cn.sdormitory.wx.req.WechatPushMessageReq;
import cn.sdormitory.wx.service.WechatPushMessageService;
import cn.sdormitory.wx.vo.WechatPushMessageVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;

/**
 * @author : yy
 * @date: 2024/9/29 15:30
 * @description:
 */
@Service
public class WechatPushMessageServiceImpl implements WechatPushMessageService {
    @Resource
    private WechatPushMessageMapper wechatPushMessageMapper;

    @Override
    public IPage<WechatPushMessageVO> listPushMessage(WechatPushMessageReq wechatPushMessageReq) {
        IPage<WechatPushMessageVO> page =  new Page<>(wechatPushMessageReq.getPageNum(), wechatPushMessageReq.getPageSize());
        wechatPushMessageMapper.listPushMessage(page, wechatPushMessageReq);
        return page;
    }

    @Override
    public void deleteByIds(Long[] ids) {
        wechatPushMessageMapper.deleteBatchIds(Arrays.asList(ids));
    }
}
